<template>
  <view class="couponListWindow" :class="coupon.coupon==true?'on':''">
    <view class='title'>优惠券<text class='iconfont icon-delete-filling' @tap='close'></text></view>
    <view class='couponList' v-if="coupon.list.length">
      <view class='item acea-row row-center-wrapper' v-for="(item , index) in coupon.list" :key="index" @tap='getCouponUser(index)'>
        <view class='money'>￥<text class='num'>{{item.redeemMoney}}</text></view>
        <view class='text'>
          <view class='condition line1'>{{item.couponRule}}</view>
          <view class='data acea-row row-between-wrapper'>
            <view>{{item.startDate}}-{{item.endDate}}</view>
            <view class='bnt gray' v-if="item.is_use">{{item.use_title || '已领取'}}</view>
            <view class='bnt bg-color' v-else>立即使用</view>
          </view>
        </view>
      </view>
    </view>
    <!-- 无优惠券 -->
    <view class='pictrue' v-else>
      <image src='https://mm.wentsoft.com/images/empty-img/coupon-empty.png'></image>
    </view>
    <view class='mask' catchtouchmove="true" :hidden='coupon.coupon==false' @tap='close'></view>
  </view>
</template>
<script>
export default {
  props: {
    coupon: {
      type: Object,
      default: {
        list: [],
        statusTile: '',
        coupon: false
      }
    }
  },
  data() {
    return {}
  },
  computed: {},

  methods: {
    close() {
      this.$emit('ChangCouponsClone');
    },
    getCouponUser(e) {
      this.$emit('ChangCoupons', e);
    },
  }
}
</script> 

<style lang="scss" scoped>
.couponListWindow {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #f5f5f5;
  border-radius: 16rpx 16rpx 0 0;
  z-index: 111;
  transform: translate3d(0, 100%, 0);
  transition: all 0.3s cubic-bezier(0.25, 0.5, 0.5, 0.9);
  z-index: 1000;
}
.couponListWindow.on {
  transform: translate3d(0, 0, 0);
}
.couponListWindow .title {
  height: 124rpx;
  width: 100%;
  text-align: center;
  line-height: 124rpx;
  font-size: 32rpx;
  font-weight: bold;
  position: relative;
}
.couponListWindow .title .iconfont {
  position: absolute;
  right: 30rpx;
  top: 50%;
  transform: translateY(-50%);
  font-size: 35rpx;
  color: #8a8a8a;
  font-weight: normal;
}
.couponListWindow .couponList {
  margin: 0 0 50rpx 0;
  height: 550rpx;
  overflow: auto;
}
.couponList {
  padding: 0 30rpx;
  margin-top: 25rpx;
}
.couponListWindow .pictrue {
  width: 414rpx;
  height: 336rpx;
  margin: 0 auto 50rpx auto;
}
.couponListWindow .pictrue image {
  width: 100%;
  height: 100%;
}
.couponList .item {
  width: 100%;
  height: 170rpx;
  margin-bottom: 16rpx;
}
.acea-row {
  display: flex;
  flex-wrap: wrap;
}
.couponList .item .money {
  background-image: url();
  background-repeat: no-repeat;
  background-size: 100% 100%;
  width: 240rpx;
  height: 100%;
  color: #fff;
  font-size: 36rpx;
  font-weight: bold;
  text-align: center;
  line-height: 170rpx;
}
.couponList .item .text {
  width: 450rpx;
  padding: 0 17rpx 0 24rpx;
  box-sizing: border-box;
  background-color: #fff;
}
.couponList .item .text .condition {
  font-size: 30rpx;
  color: #282828;
  height: 93rpx;
  line-height: 93rpx;
  border-bottom: 1rpx solid #f0f0f0;
}
.line1 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.couponList .item .text .data {
  font-size: 20rpx;
  color: #999;
  height: 76rpx;
}
.acea-row.row-between-wrapper {
  align-items: center;
  justify-content: space-between;
}
.acea-row.row-center-wrapper {
  align-items: center;
  justify-content: center;
}
.couponList .item .money .num {
  font-size: 60rpx;
}
.couponList .item .text .data .bnt {
  width: 136rpx;
  height: 44rpx;
  border-radius: 22rpx;
  font-size: 22rpx;
  text-align: center;
  line-height: 44rpx;
  color: #fff;
}
.bg-color {
  background-color: #e93323 !important;
}
.couponList .item .text .data .bnt.gray {
  background-color: #ccc;
}
</style>
